package com.pen.interfece.controller.user;

import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class mvcController {

    private final ResourceLoader resourceLoader;

    public mvcController(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
    }

    @GetMapping("/static/{filename}")
    public ResponseEntity<Resource> getImage(@PathVariable String filename) {
        Resource resource = resourceLoader.getResource("E:\\uploads\\images" + filename);
        return ResponseEntity.ok().body(resource);
    }
}
